<?php

require_once('alipay.function.php');
require_once('alipay_submit.class.php');
class AlipayService {
var $aliapy_config;
var $alipay_gateway_new = 'https://mapi.alipay.com/gateway.do?';
var $alipay_gateway_old = 'https://www.alipay.com/cooperate/gateway.do?';
function __construct($aliapy_config){
$this->aliapy_config = $aliapy_config;
}
function AlipayService($aliapy_config) {
$this->__construct($aliapy_config);
}
function alipay_auth_authorize($para_temp) {
$para_temp['service'] = 'alipay.auth.authorize';
$para_temp['target_service'] = 'user.auth.quick.login';
$para_temp['partner'] = trim($this->aliapy_config['partner']);
$para_temp['return_url'] = trim($this->aliapy_config['return_url']);
$para_temp['_input_charset'] = trim(strtolower($this->aliapy_config['input_charset']));
$button_name = '支付宝快捷登录';
$alipaySubmit = new AlipaySubmit();
$html_text = $alipaySubmit->buildForm($para_temp,$this->alipay_gateway_new,'get',$button_name,$this->aliapy_config);
return $html_text;
}
function query_timestamp() {
$url = $this->alipay_gateway_new.'service=query_timestamp&partner='.trim($this->aliapy_config['partner']);
$encrypt_key = '';
$xml_data = getHttpResponse($url);
$para_data = @XML_unserialize($xml_data);
$encrypt_key = $para_data['alipay']['response']['timestamp']['encrypt_key'];
return $encrypt_key;
}
function alipay_interface($para_temp) {
$para_temp['service'] = 'alipay_interface';
$para_temp['partner'] = trim($this->aliapy_config['partner']);
$para_temp['_input_charset'] = trim(strtolower($this->aliapy_config['input_charset']));
$alipaySubmit = new AlipaySubmit();
$html_text = '';
return $html_text;
}
}
?>